import pygame
from pygame import font



class GameUI:
    WIDTH = int(576 * 1.5 + 144)
    HEIGHT = int(480 * 1.5)
    GameCaption = "魔塔"
    imgObjects = []

    screen = pygame.display.set_mode((WIDTH, HEIGHT))
    baseScreen = screen.copy()
    background_color = (0, 0, 0)

    def __init__(self):
        pygame.init()
        pygame.display.set_caption(GameUI.GameCaption)
        self.show_basic_interface()
        self.baseScreen = self.screen.copy()

    def show_basic_interface(self):
        self.screen.fill(self.background_color)

    def show_image_objects(self):
        for obj in self.imgObjects:
            obj.update()
            self.screen.blit(obj.image, obj.rect)

    @staticmethod
    def add_image_object(obj):
        GameUI.imgObjects.append(obj)

    def update(self):
        self.show_image_objects()
        pygame.display.flip()
        self.screen.blit(self.baseScreen, (0, 0))